﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using Npgsql;

namespace Ortodoctor.modelo
{
    class conexao
    {
        public static NpgsqlConnection conn;

        public conexao()
        {
            //string connectionstring = ("Server=186.202.152.24;Port=5432;User Id=ortodoctor1;Password=DycbqDfHLI;Database=ortodoctor1;MinPoolSize=5;CommandTimeout=60;");
            string connectionstring = ("Server=localhost;Port=5432;User Id=postgres;Password=postgres;Database=ortodoctor;MinPoolSize=5;CommandTimeout=60;");
        }

        ~conexao()
        {
            close();
        }

        public void open()
        {
            if (conn.State.ToString().Equals("Closed"))
            {
                conn.Open();
            }
        }

        public void close()
        {
            conn.Close();
        }
    }
}
